Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link libssp when targetted #100

Merged
merged 2 commits into from Sep 2, 2016
Merged

Link libssp when targetted #100

merged 2 commits into from Sep 2, 2016

Conversation

ghost
Copy link

@ghost ghost commented Aug 29, 2016

Please let me know if this PR is redundant, it fixes the following issue for me however using MSYS2 and g++.

The condition

else (MSVC)
...
    add_compile_options(-fstack-protector -Wall -Winit-self -Wswitch-enum -Wshadow -Winline)
...
endif (MSVC)

enforces -fstack-protector. Any library linking SQLiteCpp then requires libssp, so I have added a target_link_libraries to the CMakeLists.txt file to support this.

@ghost ghost closed this Aug 29, 2016
@ghost
Copy link
Author

ghost commented Aug 29, 2016

Closed as this caused build issues, it's probably more sensible to deal with this in the project targetting SQLiteCpp.

@ghost
Copy link
Author

ghost commented Aug 29, 2016

For any who might read this, I fixed this with the following addition to my CMakeLists.txt.

if (UNIX)
    target_link_libraries( <name> pthread )
    if (NOT APPLE)
        target_link_libraries( <name> dl )
    endif ()
elseif (MSYS)
    target_link_libraries( <name> ssp )
endif ()

@SRombauts
Copy link
Owner

Hi @Asriwi, thanks for reporting this!

Could you update this Merge Request with the code you are using?

Also, I should really update the AppVeyor continuous integration build script to add build for MSYS and MINGW...

Cheers!

@ghost ghost reopened this Aug 30, 2016
@ghost
Copy link
Author

ghost commented Aug 30, 2016

Hi @SRombauts,

I've applied this change to the SQLITECPP_BUILD_EXAMPLES option to cover builds of the executable under MSYS and MINGW.

I'm using the same linking as the examples (given below) for my own project with success.

# Link target with pthread and dl for linux
if (UNIX)
    target_link_libraries(SQLiteCpp_example1 pthread)
    if (NOT APPLE)
        target_link_libraries(SQLiteCpp_example1 dl)
    endif ()
elseif (MSYS OR MINGW)
    target_link_libraries(SQLiteCpp_example1 ssp)
endif ()

I've tested this on:

  • Ubuntu 16.04.1 using g++
  • MSYS2 on Windows 10 using g++ and clang (both mingw64)
  • MinGW on Windows 10 using g++ (mingw64)
  • VS14 on Windows 10
  • Travis with the included travis.yml

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.984% when pulling acbad05 on Asriwi:master into d04c869 on SRombauts:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.984% when pulling acbad05 on Asriwi:master into d04c869 on SRombauts:master.

@SRombauts SRombauts merged commit 6d1806b into SRombauts:master Sep 2, 2016
@SRombauts
Copy link
Owner

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants